home *** CD-ROM | disk | FTP | other *** search
/ Sun Solutions 1997 April to September / Sun Solutions CD - APR '97 - SEP '97 (704-3778-12 Rev. H)(Sun Microsystems, Inc.)(1997).iso / products / bin / httpd / Solaris_2 / showme.pl < prev    next >
Perl Script  |  1996-09-30  |  2KB  |  85 lines

  1. #!./perl
  2.  
  3. $file = "./le_list.txt";
  4. #$file = "/solutions/.products/.bin/httpd/Solaris_2/le_list.txt";
  5. $start = "yes";
  6. $getum = "no";
  7. $totalhits=0;
  8. $tmphits = 0;
  9.  
  10. sub error
  11. {
  12. }
  13.  
  14. open(IN,$file) || die &error;
  15.      while (<IN>) {
  16.         @tmp = split(/\t/,$_);
  17.         chop($_);
  18.       $getum = "yes";
  19.       if ($start eq "yes" && @tmp[0] ne "" ) { $company = $tmp[0];$getum = "no";$start = "no";}
  20.  
  21.           if (@tmp[0] ne ""  && $start ne "yes" ) {$companies{$company} =join(":",@urllist);$company=@tmp[0];$getum = "no";@urllist = ();} 
  22.       
  23.  
  24.       if (@tmp[0] eq "" && $getum eq "yes") {
  25.           chop(@tmp[2]);
  26.           push(@urllist, "@tmp[1]:@tmp[2]");
  27.       }
  28.      } 
  29.  
  30. $companies{$company} =join(":",@urllist);
  31.  
  32. close(IN);
  33.         $~ = HTMLHEADER;
  34.     write STDOUT;
  35.      foreach $key  (sort keys(%companies)) {
  36.     $realkey = $key;
  37.     chop($key);
  38.     @stats = split(/:/,$companies{$realkey});
  39.     %final = @stats;
  40.     print "<dt><b>$key</b><br>\n";
  41.     while (($url, $hits) = each(%final)) {
  42.         
  43.             $tmphits = ($tmphits + $hits);    
  44.         $~ = EACHCOMP;
  45.         write STDOUT;
  46.     }
  47.     $totalhits = ($totalhits + $tmphits);
  48.     print "Total for $key: <b>$tmphits</b><br>\n";
  49.     $tmphits = 0;
  50.         
  51.     #print "$key $companies{$realkey}\n";
  52.      }
  53.     $Final = $final{"chuck"};
  54.     print "<dt>Total Hits: <b>$totalhits</b><br>\n";
  55.     $~ = HTMLFOOTER;
  56.     write STDOUT;
  57.  
  58.  
  59.  
  60.  
  61. #######################################
  62. #Formats
  63. #######################################
  64. format EACHCOMP =
  65. <dd>          @<<<<<<<<<<<<<<<<<<<<<<<<<<<          @#####<br>
  66. $url, $hits
  67. .
  68. ##################################
  69. format HTMLHEADER =
  70. Content-type: text/html
  71.  
  72.  
  73.  
  74. <html>
  75. <body>
  76. <h1>Outside hits from the Sun Solutions CD</h1>
  77. <dl>
  78. .
  79. ##################################
  80. format HTMLFOOTER =
  81. </dl> 
  82. </body>
  83. </html>
  84. .
  85.